﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace YiDingCanWp7
{
    public class FavoriteShops
    {
        public static FavoriteShops Instance = new FavoriteShops();
        private Setting<List<ShopDTO>> favorateShop = new Setting<List<ShopDTO>>("FavorateShop", null);
        public List<ShopDTO> FavorateShop {
            get {
                return favorateShop.Value;
            }
            set {
                favorateShop.Value = value;
            }
        }
        public static void AddFavorate(ShopDTO shop) {
            FavoriteShops f = new FavoriteShops();
            List<ShopDTO> shops = f.FavorateShop;
            if (shops==null)
            {
                shops = new List<ShopDTO>();
            }
            if(!shops.Contains(shop))
            shops.Add(shop);
            f.FavorateShop = shops;
        }
        public static void Remove(ShopDTO shop) {
            List<ShopDTO> shops = Instance.FavorateShop;
            shops.Remove(shop);
            Instance.FavorateShop = shops;
        }
    }
}
